		<html>
		<head>
			<title>User Profile</title>
			<script type="text/javascript" src="/js/creditcard.js"> </script>
			
			<script type="text/javascript">
			
			function testCreditCard () {
			  var cardNumber = document.getElementById('cardNumber').value;
			  var cardType = document.getElementById('cardType').value;
			  if (checkCreditCard (cardNumber,cardType)) {
			    //alert ("Credit card has a valid format")
			    return true;
			  } 
			  else {
			    //alert (ccErrors[ccErrorNo])
			  	return false;
			  };
			}	
			
			function validateEmail(email) {
 			   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
			   if(reg.test(email) == false) {
			      return false;
			   } else {
			   	  return true;	
			   }
			}			
			
			function validateForm() {
				var loginId = document.getElementById('loginId').value;
				var password = document.getElementById('password').value;
			  	var name = document.getElementById('name').value;
			  	var email = document.getElementById('email').value;
				var cardName = document.getElementById('cardName').value;
			  	var cardNumber = document.getElementById('cardNumber').value;
			  	var cardType = document.getElementById('cardType').value;
			  	var expiredDate = document.getElementById('expiredDate').value;

			 	var errorText="";
			 	
		    	if (loginId == "") {
			    	errorText+="- Login Id is mandatory";
			    	errorText+="\n"
			    }

			    if (password == "") {
			    	errorText+="- Password is mandatory";
			    	errorText+="\n"
			    }
			    
			    if (name == "") {
			    	errorText+="- Name is mandatory";
			    	errorText+="\n"
			    }
 
			    if (email == "") {
			    	errorText+="- Email is mandatory";
			    	errorText+="\n"
			    } else {
			    	if (validateEmail(email) == false) {
				    	errorText+="- Wrong Email format";
				    	errorText+="\n"
			    	} 
			    }
			    
			    if (cardName == "") {
			    	errorText+="- Card Name is mandatory";
			    	errorText+="\n"
			    }
		    
			    if (cardType == "") {
			    	errorText+="- Card Type is mandatory";
			    	errorText+="\n"
			    } 
			    
			    if (cardNumber == "") {
			    	errorText+="- Card Number is mandatory";
			    	errorText+="\n"
			    } else {
			    	if (testCreditCard() == false) {
				    	errorText+="- Credit Card is not a Valid Type";
				    	errorText+="\n"
			    	} 
			    }
			    
			    if (expiredDate == "") {
			    	errorText+="- Card Expiry Date is mandatory";
			    	errorText+="\n"
			    }
				return errorText;
			
			}
			
			function submitForm() {
			 var errorText = validateForm();
			    if (errorText=="") { 
			    	document.getElementById('myform').submit(); }
			    else {
			     	alert(errorText);
			    }
			}
			</script>
			
		</head>
		<body>		
				<h1>Registration</h1>
				<p>*) Mandatory Field</p>
				<form id="myform" action="/service/user.register" method="POST" >
				<table border="0" cellpadding="0" cellspacing="0"  >
				    <tr><td colspan="2">
					<b>User Profile</b> </td></tr>
				    <tr><td align="left">
					Login Id*:</td><td align="left">
					<input type="text" value="" name="loginId" id="loginId"/></td></tr><tr><td align="left">
					Password*:</td><td align="left">
					<input type="password" value="" name="password" id="password"/></td></tr><tr><td align="left">
					Name*:</td><td align="left">
					<input type="text" value="" name="name" id="name"/></td></tr><tr><td align="left">
					Email*:</td><td align="left">
					<input type="text" value="" name="email" id="email"/></td></tr><tr><td colspan="2">
					<br></br>
					<b>Credit Card</b> </td></tr><tr><td align="left">
					Name of Card Holder*:</td><td align="left">
					<input type="text" value="" name="cardName" id="cardName"/></td></tr><tr><td align="left"> 
					Type of Card*:</td><td align="left">
					<select id="cardType" name="cardType" >
					  <option value="MASTERCARD">MasterCard</option>
					  <option value="VISA">Visa</option>
					</select>
					</td></tr><tr><td align="left" valign="top">
					Credit Card Number*:</td><td align="left" >
					<input type="text" value="" name="cardNumber" id="cardNumber" size="16" maxLength="16"/> <br>(e.g. 5500000000000004)</td></tr><tr><td align="left" valign="top">
					Expiry Date (MMYYYY)*:</td><td align="left">
					<input type="text" value="" name="expiredDate" id="expiredDate" size="6" maxLength="6"/> <br> (e.g. 022015)</td></tr><tr align="center"><td colspan="2" >
					<br></br>
					
					<button id="mybutton" type="button" onclick="submitForm()">Submit</button>

					</td></tr>
				</table>
				</form>
		</body>

	</html>
